class nlp_architect.pipelines.spacy_np_annotator.NPAnnotator(model, word_vocab, char_vocab, chunk_vocab, batch_size: int = 32)[source]

Spacy based NP annotator - uses models.SequenceChunker model for annotation

  • model (SequenceChunker) – a chunker model

  • word_vocab (Vocabulary) – word-id vocabulary of the model

  • char_vocab (Vocabulary) – char id vocabulary of words of the model

  • chunk_vocab (Vocabulary) – chunk tag vocabulary of the model

  • batch_size (int, optional) – inference batch size

__init__(model, word_vocab, char_vocab, chunk_vocab, batch_size: int = 32)[source]

Initialize self. See help(type(self)) for accurate signature.


__init__(model, word_vocab, char_vocab, …)

Initialize self.

load(model_path, parameter_path, batch_size, …)

Load a NPAnnotator annotator

classmethod load(model_path: str, parameter_path: str, batch_size: int = 32, use_cudnn: bool = False)[source]

Load a NPAnnotator annotator

  • model_path (str) – path to trained model

  • parameter_path (str) – path to model parameters

  • batch_size (int, optional) – inference batch_size

  • use_cudnn (bool, optional) – use gpu for inference (cudnn cells)


NPAnnotator class with loaded model